<template>
    <div class="sys-page">
        <template v-if="showEditCompany">
            <company-edit></company-edit>
        </template>
        <template v-else>
            <company-search></company-search>
        </template>
    </div>
</template>

<script>
    import CompanyEdit from './company_edit';
    import CompanySearch from './company_search';
    import { mapState, mapActions } from 'vuex'

    export default {
        name: "company",
        components: {CompanySearch, CompanyEdit},

        mounted() {
            let ctype = this.$route.params.ctype;
            console.log("公司类型：", ctype);
            this.loadInitPageData(ctype)
        },

        methods: {
            ...mapActions({
                loadInitPageData: 'company/loadInitPageData',
            }),
        },

        computed: {
            ...mapState({
                showEditCompany: state => state.company.showEditCompany
            })
        }
    }
</script>

